package com.glls.java2217.controller;

import com.glls.java2217.common.R;
import com.glls.java2217.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @date 2023-01-04
 * @desc
 */
@RequestMapping("/user")
@RestController
public class UserController {

    @RequestMapping("/login")
    public R login(String username, String password, HttpServletResponse response, HttpServletRequest request){
        //
        //String origin = request.getHeader("Origin");
        //
        //response.setHeader("Access-Control-Allow-Origin",origin);
        //response.setHeader("Access-Control-Allow-Credentials","true");

        User user = new User(username, password);

        System.out.println(username);
        System.out.println(password);

        return R.ok().data("currentUser",user);

    }


}
